using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace InduMall.Core.Models.Mapping
{
    public class ShoppingCartMap : EntityTypeConfiguration<ShoppingCart>
    {
        public ShoppingCartMap()
        {
            // Primary Key
            this.HasKey(t => t.ShoppingCartId);

            // Properties
            // Table & Column Mappings
            this.ToTable("ShoppingCart");
            this.Property(t => t.ShoppingCartId).HasColumnName("ShoppingCartId");
            this.Property(t => t.CartType).HasColumnName("CartType");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.ModifiedDate).HasColumnName("ModifiedDate");

            // Relationships
            this.HasRequired(t => t.User)
                .WithOptional(t => t.ShoppingCart);

        }
    }
}
